package yao.spider.jsoup.xiangrikui;

import java.util.ArrayList;
import java.util.List;

import yao.common.excel.ExcelCreator;

/**
 * 向日葵代理人数据爬虫
 * 需要获取的地址
 * http://a.xiangrikui.com/sf-cs/gs.html?page=1 -- http://a.xiangrikui.com/sf-cs/gs.html?page=3163
 * 获取手机号 http://common.xiangrikui.com/api/users/691436
 * @author chenyao
 * @date 2016年11月28日 下午6:22:38
 */
public class XiangRiKuiRangeSpider extends XiangRiKuiSpider {
	
	private static final String AGENT_URL_PREFIX = "http://a.xiangrikui.com/sf-cs/gs.html?page=";
	
	private final int firstPage;
	private final int endPage;
	
	public XiangRiKuiRangeSpider(String errorFilePath,ExcelCreator excelCreator, int firstPage, int endPage) {
		super(errorFilePath,excelCreator);
		this.firstPage = firstPage;
		this.endPage = endPage;
	}

	@Override
	protected List<String> getUrls() {
		List<String> urls = new ArrayList<String>();
		for(int i = firstPage; i < endPage; i++) {
			String url = AGENT_URL_PREFIX + i;
			urls.add(url);
		}
		return urls;
	}
}
